<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        #wrap {
            height: 400px;
            width: 400px;
            border: 1px solid;
            margin: 0 auto;
            text-align: center;
        }
        #wrap:after {
            /*给定图片对齐的参照*/
            content: '';
            display: inline-block;
            height: 100%;
            width: 0px;
            background: pink;
            vertical-align: middle;
        }
        #wrap img {
            vertical-align: middle;
            border: 1px solid deeppink;
        }
    </style>
</head>
<body>
    <div id="wrap">
        <img src="img/1.jpg" width="150px"/>
    </div>
</body>
</html>
